#ifndef RAY_H
#define RAY_H

#include "Point3D.h"
#include "Vector3D.h"

namespace geom
{
    /** Class that represents a ray shooting from a point in a certain
      direction. It's intended to be used primarily in collision detection
      algorithms */

    class Ray
    {
        protected:
            /** Point from which the Ray originates */
            Point3D p;
            /** Direction taken by the Ray */
            Vector3D v;

        public:
            /** Constructor
              @param origin Point the Ray originates from
              @param vec Direction the Ray takes */
			Ray(Point3D origin, Vector3D vec): p(origin), v(vec){}

            /** Returns the origin of the Ray */
            const Point3D & origin() const {return p;}

            /** Returns the direction of the Ray */
            const Vector3D & direction() const {return v;}

            /** Returns the point the Ray will reach when it has traveled the 
              given distance */
            Point3D atDistance(const float& dist) const {  return p + v.getWithModule(dist);}

    };
}

#endif
